package copyengine.ui.component.list.old.animation
{
	import com.greensock.TweenLite;
	
	import flash.display.DisplayObjectContainer;

	public class ShopMonsterListCellRenderAnimation implements ICEListCellRenderAnimation
	{
		/**
		 * define how long the tween is.
		 */
		private static const TWEEN_TIME:Number = 0.2;

		/**
		 * rolloverScal = normalScale * ROLL_OVER_SCAL_PERCENT;
		 * clickScal = normalScale * CLICK_SCAL_PERCENT;
		 */
		private static const ROLL_OVER_SCAL_PERCENT:Number = 1.08;
		private static const CLICK_SCAL_PERCENT:Number = 1;

		/**
		 * button skin maybe scaled  so need an value to remember the button initial value .
		 */
		private var normalScaleX:Number;
		private var normalScaleY:Number;

		private var cellRenderContainer:DisplayObjectContainer;

		public function ShopMonsterListCellRenderAnimation()
		{
		}

		public function set target(_cellRenderContainer:DisplayObjectContainer):void
		{
			cellRenderContainer = _cellRenderContainer;
			normalScaleX = cellRenderContainer.scaleX;
			normalScaleY = cellRenderContainer.scaleY;
			cellRenderContainer["circle"].visible = false;
		}

		public function dispose():void
		{
			TweenLite.killTweensOf(cellRenderContainer);
			cellRenderContainer = null;
		}

		public function onRollOver():void
		{
			TweenLite.killTweensOf(cellRenderContainer, true);
			TweenLite.to(cellRenderContainer, TWEEN_TIME, {scaleX:normalScaleX * ROLL_OVER_SCAL_PERCENT, scaleY:normalScaleY * ROLL_OVER_SCAL_PERCENT});
			//cellRenderContainer["circle"].visible = true;
		}

		public function onRollOut():void
		{
			TweenLite.killTweensOf(cellRenderContainer, true);
			TweenLite.to(cellRenderContainer, TWEEN_TIME, {scaleX:normalScaleX * CLICK_SCAL_PERCENT, scaleY:normalScaleY * CLICK_SCAL_PERCENT});
			//cellRenderContainer["circle"].visible = false;
		}

		public function onSelect(_isSelected:Boolean):void
		{
		}
		
	}
}
